package ae.pcfc.etks.online.itworx.ehs.web.manager.impl;

import java.util.List;

import ae.pcfc.etks.online.itworx.ehs.web.dao.WorkflowDAO;
import ae.pcfc.etks.online.itworx.ehs.web.entity.OFCRequest;
import ae.pcfc.etks.online.itworx.ehs.web.entity.OFCRequestHistory;
import ae.pcfc.etks.online.itworx.ehs.web.entity.Request;
import ae.pcfc.etks.online.itworx.ehs.web.enums.RequestStatus;
import ae.pcfc.etks.online.itworx.ehs.web.manager.WorkflowManager;
import ae.pcfc.etks.online.itworx.ehs.web.model.RequestSearchCriteria;

public class WorkflowManagerImpl extends BaseManagerImpl implements
		WorkflowManager {

	private WorkflowDAO workflowDAO;

	public void setWorkflowDAO(WorkflowDAO workflowDAO) {
		this.workflowDAO = workflowDAO;
	}

	public WorkflowDAO getWorkflowDAO() {
		return workflowDAO;
	}

	/*public List<Request> getAllRequests(String userId, String companyName,
			UserType user, Date creationDateFrom, Date creationDateTo,
			RequestStatus requestStatus, RequestField sortField,
			boolean ascending, int pageNo) {
		return workflowDAO.getAllRequests(userId, companyName, user,
				creationDateFrom, creationDateTo, requestStatus, sortField,
				ascending, pageNo);
	}*/

	public List<OFCRequest> getAllRequestsByStatus(List<RequestStatus> requestsStatus)
	{
		return workflowDAO.getAllRequestsByStatus(requestsStatus);
	}
	
	public OFCRequest getRequestDetails(Long requestId) {
		return workflowDAO.getRequestDetails(requestId);
	}

	public List<OFCRequestHistory> getRequestHistory(Long requestId) {
		return workflowDAO.getRequestHistory(requestId);
	}

	public void createOFCRequest(OFCRequest ofcRequest) {

		workflowDAO.createOFCRequest(ofcRequest);
	}

	@Override
	public void updateOFCRequest(OFCRequest ofcRequest) {
		//workflowDAO.updateObject(ofcRequest);
		workflowDAO.updateOFCRequest(ofcRequest);
	}
	
	public List<Request> getAllRequests(String userName,boolean isOfficer ,RequestSearchCriteria criteria){
		return workflowDAO.getAllRequests(userName, isOfficer,  criteria);
	}

	@Override
	public List<Request> getAllActiveTasks(String userName, boolean isOfficer,
			RequestSearchCriteria criteria, List<String> tasksUsers,boolean isAssigned) {
		return workflowDAO.getAllRequests(userName, isOfficer,  criteria, tasksUsers,isAssigned);
	}

	@Override
	public long getAllRequestsSize(String userName, boolean isOfficer,
			RequestSearchCriteria searchCriteria) {
		return  workflowDAO.getAllRequestsSize(userName, isOfficer, searchCriteria);
	}
	
	public long getAllActiveTasksSize (String userName, boolean isOfficer, RequestSearchCriteria searchCriteria,List<String> tasksUsers,boolean isAssigned){
		return  workflowDAO.getAllActiveTasksSize(userName, isOfficer, searchCriteria, tasksUsers,isAssigned);
	}

	@Override
	public OFCRequest getRequestByIdAndUsername(long requestId, String username, List<String> taskUsers, boolean isOfficer) {
		return workflowDAO.getRequestByIdAndUsername(requestId, username, taskUsers, isOfficer);
	}
	
	@Override
	public long getActiveRequestSize(String userName){
		return workflowDAO.getActiveRequestSize(userName);
	}

}
